<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="btn">Click</button>
    <script>
        //注册点击事件
        document.getElementById('btn').addEventListener('click', function () {
            fetch('http://localhost:3000/')
            .then(async response => {
                const data = await response.json();
                console.log(data);
            })
            .catch(err => {
                console.error('Fetch error:', err);
            });
        })
    </script>
</body>
</html>